﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DIT.Contract;
using DIT.DB.Database;
using DIT.DB.DAL;
using DIT.Service;
using DIT.Domain;
using DIT.Utility;

namespace ServiceHelper
{
    public class TaxPayerServiceHelper
    {
        private DatabaseBase database;
        private IRepository repository;

        private static TaxPayerServiceHelper serviceHelper = null;
        private static object _lock = new object();
        private TaxPayerServiceHelper()
        {
            Init();
        }
        public static TaxPayerServiceHelper Instance
        {
            get
            {
                lock (_lock)
                {
                    if (serviceHelper == null)
                        serviceHelper = new TaxPayerServiceHelper();
                    return serviceHelper;
                }
            }
        }
        public ITaxPayerService Service { get { return taxPayerService; } }

        private void Init()
        {
            database = DatabaseFactory.GetDatabase(DITConfig.AppSettings["DatabaseType"]);
            repository = new DITRepository(database);

            taxPayerService = new TaxPayerService(repository);
        }
        private ITaxPayerService taxPayerService;
    }
}
